home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 526-550 / disk_540 / parm / parm_src.lzh / libstart.asm < prev    next >
Assembly Source File  |  1991-07-03  |  2KB  |  112 lines

  1. ;/*
  2. ; *     libstart.asm - Copyright © 1991 by S.R. & P.C.
  3. ; *
  4. ; *     Created:    22 Sep 1990  20:54:22
  5. ; *     Modified:    03 Jul 1991  18:54:51
  6. ; *
  7. ; *     Make>> make
  8. ; */
  9.  
  10.  
  11.     include    'exec/types.i'
  12.     include    'exec/resident.i'
  13.     include    'exec/nodes.i'
  14.     include    'exec/libraries.i'
  15.  
  16. PARMVERSION    equ    1
  17. PARMPRI        equ    0
  18.  
  19.  
  20.     cseg    ; romtag must be in first hunk
  21.  
  22.     public    _ParMLibName
  23.     public    _ParMLibId
  24.     public    _ParMLibInitTab
  25.  
  26.     moveq    #0,d0        ; don't let them run me
  27.     rts
  28.     public    _ParMLibRomTag
  29.  
  30. _ParMLibRomTag:
  31.     dc.w    RTC_MATCHWORD
  32.     dc.l    _ParMLibRomTag
  33.     dc.l    endtag
  34.     dc.b    RTF_AUTOINIT
  35.     dc.b    PARMVERSION
  36.     dc.b    NT_LIBRARY
  37.     dc.b    PARMPRI
  38.     dc.l    _ParMLibName
  39.     dc.l    _ParMLibId
  40.     dc.l    _ParMLibInitTab
  41. endtag:
  42.     dc.w    0        ;to get things aligned to 4 byte boundary
  43.  
  44.  
  45. ;    For libraries:
  46. ;        library base in D0
  47. ;        segment list in A0
  48. ;        execbase in A6
  49.  
  50. ;    Initial startup routine for Aztec C.
  51.  
  52. ;    NOTE: code down to "start" must be placed at beginning of
  53. ;        all programs linked with Aztec Linker using small
  54. ;        code or small data.
  55.  
  56.  
  57.     public    .begin
  58. .begin
  59.     public    _ParMLibInit
  60. _ParMLibInit:
  61.     movem.l    d0-d7/a0-a6,-(sp)    
  62.     movem.l    d0/a0,-(sp)        ;save library parameters
  63.     bsr        _geta4            ;get A4
  64.     lea        __H1_end,a1
  65.     lea        __H2_org,a0
  66.     cmp.l    a1,a0            ;check if BSS and DATA together
  67.     bne        start            ;no, don't have to clear
  68.     move.w    #((__H2_end-__H2_org)/4)-1,d1
  69.     bmi        start            ;skip if no bss
  70.     move.l    #0,d0
  71. loop
  72.     move.l    d0,(a1)+        ;clear out memory
  73.     dbra    d1,loop
  74.  
  75. start
  76.     move.l    a6,_SysBase        ;put where we can get it
  77.  
  78.     lea    dos_name,a1        ;get name of dos library
  79.     jsr    -408(a6)        ;open the library any version
  80.     move.l    d0,_DOSBase        ;set it up
  81.     bne    3$            ;skip if okay
  82.  
  83.       move.l  #$38007,d7        ;AG_OpenLib | AO_DOSLib
  84.     jsr     -108(a6)        ;Alert
  85.     bra    4$
  86. 3$
  87.     jsr    __main            ;call the startup stuff
  88. 4$
  89.     add.w    #8,sp            ;pop args
  90.     movem.l    (sp)+,d0-d7/a0-a6
  91.     rts                ;and return
  92.  
  93. dos_name:
  94.     dc.b    'dos.library',0
  95.  
  96.     public    _geta4
  97. _geta4:
  98.     far    data
  99.     lea    __H1_org+32766,a4
  100.     rts
  101.  
  102.     public    __main,__H0_org
  103.  
  104.     dseg
  105.  
  106.     public    _SysBase,_DOSBase
  107.     public    __H1_org,__H1_end,__H2_org,__H2_end
  108.     bss    _SysBase,4
  109.     bss    _DOSBase,4
  110.  
  111.     end
  112.